#include<iostream>
#include<cmath>
#include <iomanip>
using namespace std;

const int kMaxN = 5000 + 10;

long long far[kMaxN][kMaxN] = {0};
long long far_total[kMaxN][kMaxN] = {0};
double f[kMaxN] = {0};
int x[kMaxN] = {0}, y[kMaxN] = {0}; 

long long Dist(int i, int j){
    return (long long)(x[i] - x[j]) * (x[i] - x[j]) +
     (long long)(y[i] - y[j]) * (y[i] - y[j]);
}

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    
    int n;
    
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i];
    }
    
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            far[i][j] = max(far[i][j - 1], Dist(i, j)); 
        }
    }
    for(int len = 1; len < n; len++){
        for(int i = 0, j = len; j < n; i++, j++){
            far_total[i][j] = max(far_total[i][j - 1], far_total[i + 1][j]);
            far_total[i][j] = max(far_total[i][j], far[i][j]);
        }
    }
    for(int i = 1; i < n; i++){
        f[i] = max(f[i - 1], sqrt(far_total[0][i]));
        for(int j = 0; j < i; j++){
            f[i] = max(f[i], f[j] + sqrt(far_total[j+1][i]));
        }
    }
    cout << fixed << setprecision(8) << f[n - 1] << endl; 
    return 0;
}
